package com.itheima.网络编程.网络编程基础编程.tcp;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class tcp发送数据 {
    public static void main(String[] args) throws IOException {
        tcpOutput1();
    }

    public static void tcpOutput1() throws IOException {
        Scanner sc=new Scanner(System.in);
        Socket s = new Socket("127.0.0.1", 11000);
        String send;
        while (true) {
            OutputStream os = s.getOutputStream();
            System.out.println("开始发送数据：");
            send=sc.nextLine();
            os.write(send.getBytes());
            System.out.println("发送数据成功。。");
//            os.close();
//            s.close();
        }
    }
}
